﻿using MediatR;
using SheepStorage.API.Application.Command.SheepRecordCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepRecordHandlers
{
    public class UpdateSheepRecordCommandHandler : IRequestHandler<UpdateSheepRecordCommand, Results<int>>
    {
        ISheepRecordService _res;

        public UpdateSheepRecordCommandHandler(ISheepRecordService res)
        {
            _res = res;
        }

        public async Task<Results<int>> Handle(UpdateSheepRecordCommand request, CancellationToken cancellationToken)
        {
            var list =await  _res.UpdateSheepRecord(request.input);
            return Results<int>.DataResult(list);
        }
    }
}
